<template>
  <div class="app-container">
    <div class="filter-container">
      <statisSearchBar :start-date="searchForm.startDate" :end-date="searchForm.endDate" :showp-pf-channel="true" @transferFilter="handleFilter">
        <!-- <template #extra-filters>
          <el-date-picker v-model="listQuery.createtime[0]" class="filter-item" type="date" style="width: 140px;" placeholder="创角时间"></el-date-picker>-
          <el-date-picker v-model="listQuery.createtime[1]" class="filter-item" type="date" style="width: 140px;" placeholder="创角时间"></el-date-picker>
        </template> -->
      </statisSearchBar>
      <span style="float: right; margin-top: 10px;">总充值人数：{{ total }}；总充值金额：{{ pay_amount }}</span>
    </div>
    <el-table v-loading="listLoading" :data="list" class="mt-10" border height="725">
      <el-table-column label="排名" prop="rank" width="50px" align="center"></el-table-column>
      <el-table-column label="账号" prop="account" width="160px" align="center"></el-table-column>
      <el-table-column label="充值金额" prop="total_amount" width="110px" align="center"></el-table-column>
      <el-table-column label="充值次数" prop="num" width="90px" align="center"></el-table-column>
      <el-table-column label="分服充值" prop="other_sid_info" width="300px" align="center"></el-table-column>
      <el-table-column label="最后充值角色ID" prop="actor_id" width="110px" align="center"></el-table-column>
      <el-table-column label="最后充值角色名" prop="actor_name" width="110px" align="center"></el-table-column>
      <el-table-column label="最后充值创角时间" prop="reg_date" width="150px" align="center"></el-table-column>
      <el-table-column label="最后充值服务器" prop="sname" width="150px" align="center"></el-table-column>
      <el-table-column label="最后充值时间" prop="pay_datedt" width="150px" align="center"></el-table-column>
      <el-table-column label="最后登录时间" prop="last_login_time" width="150px" align="center"></el-table-column>
      <el-table-column label="未登录天数" prop="no_loing_day" width="90px" align="center"></el-table-column>
    </el-table>
    <pagination v-show="total>0" :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.limit" @pagination="getList" />
  </div>
</template>

<script>
import StatisSearchBar from '@/components/StatisSearchBar'
import Pagination from '@/components/Pagination'
import { objectMerge } from '@/utils'
import { getRechargeRanking } from '@/api/statis'

export default {
  name: 'RechargeRanking',
  components: { StatisSearchBar, Pagination },
  data() {
    return {
      list: [],
      headList: [],
      total: 0,
      pay_amount: 0,
      listLoading: false,
      listQuery: {
        page: 1,
        limit: 200,
        createtime: ['', '']
      },
      searchForm: {
        startDate: new Date(),
        endDate: new Date(),
      }
    }
  },
  created() {
    this.getList()
  },
  methods: {
    handleFilter(query) {
      this.searchForm = query
      this.getList()
    },
    async getList() {
      const query = objectMerge(this.searchForm, this.listQuery)
      this.listLoading = true
      const res = await getRechargeRanking(query)
      this.listLoading = false
      this.list = res.data.items
      this.total = res.data.total
      this.pay_amount = res.data.pay_amount
    }
  }
}
</script>
<style lang="scss">

</style>
